# coding=UTF-8
from django.utils.translation import ugettext as _
from djopping_mail.email import load_template, write_email, send_email

def send_registration_key(user, key):
    mail_subject = _(u'Su clave de acceso')
    mail_body = load_template('djopping/user/registration_key.txt', { 'user': user, 'key': key, 'date': user.registration.get().get_date() })
    mail_to = u'%(nombre)s <%(email)s>' % { 'nombre': user.first_name + " " + user.last_name, 'email': user.email }
    return send_email(write_email(mail_subject, mail_body, mail_to))
